from django.db import models
from django.contrib.auth.models import User


# Create your models here.
class Customer(models.Model):
    customer_name = models.CharField(max_length=16)
    comment = models.TextField(null=True, blank=True)
    create_date = models.DateTimeField(auto_now_add=True)
    modify_date = models.DateTimeField(auto_now=True)

    def __str__(self):
        return self.customer_name


class Account(models.Model):
    owner = models.ForeignKey(Customer)
    user_name = models.OneToOneField(User, on_delete=models.CASCADE)
    phone = models.CharField(max_length=15, null=True, blank=True)

    def __str__(self):
        return self.user_name.username